package com.stx.servlet.zuhu;

import com.stx.bean.Zuhu;
import com.stx.mapper.ZuhuMapper;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.sql.SQLException;

/*修改租户信息servlet*/
@WebServlet(urlPatterns = {"/zuhuUpdatePage"})
public class zuhuUpdatePageServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        try {
            Zuhu zuhu = ZuhuMapper.findZuhuById(id);
            HttpSession session = req.getSession();
            session.setAttribute("zuhuInfo", zuhu);
            req.getRequestDispatcher("/zuhuUpdate.jsp").forward(req,resp);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }

}
